﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FacebookWrapper.ObjectModel;

namespace B13_Ex02_David_300512340_Alexey_321203689
{
    public class SearchPostByDate : ISearchPost
    {
        public List<FeedWrapper> SearchPost(ValuesToSearch i_SearchValue)
        {
            List<FeedWrapper> feedList = new List<FeedWrapper>();
            List<FeedWrapper> sortFeedList = new List<FeedWrapper>();

            feedList = i_SearchValue.User.GetFeedsList();
            foreach (Post feed in i_SearchValue.User.UserInformation.NewsFeed)
            {
                if (feed.Message != null)
                {
                    if ((feed.CreatedTime >= i_SearchValue.StartDate) && (feed.CreatedTime <= i_SearchValue.EndDate))
                    {
                        sortFeedList.Add(new FeedWrapper() { Feed = feed });
                    }
                }
            }

            return sortFeedList;
        }
    }
}
